﻿using Emoney.UserTraining.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NHibernate.Linq;

namespace Emoney.UserTraining.DAL
{
   public class Web_TrainUserDAL
    {
       public List<Web_TrainUser> GetListByMonth(Web_TrainUserQuery c)
       {
           using (EMweb_newContext context = new EMweb_newContext())
           {
               DateTime now = DateTime.Now;
               DateTime d1 = new DateTime(now.Year, now.Month, 1);
               DateTime d2 = d1.AddMonths(1).AddDays(-1);
               var query = context.web_TrainUserS.Where(x => x.username == c.UserName && x.addtime >= d1 && x.addtime <= d2).Cacheable();
               return query.Cacheable().ToList();
           }
       }
    }
}
